﻿@model LeadMaster.ViewModels.ViewModelSurveys

<style type="text/css">
    th
    {
        font-family: Arial, Helvetica, sans-serif; 
        font-size: 12px; 
        font-weight: bolder;
        color: #808080;
        height: 40px;
        font-style:italic;
    }
</style>

@{
    ViewBag.Title = "ExportMapping";
}
<div style="margin-left: 20px; margin-top: 20px;">
<label class="boxtitle">Export Mapping : @Model.Surveys.Ref</label>
<div class="spacer"></div>

@using (Html.BeginForm("ExportMapping", "Leads", FormMethod.Post, new { @class = "formExportMapping" }))
{
    @Html.ValidationSummary(true)
    <fieldset style="border-style: none; width: 500px;">
        @Html.HiddenFor(m => m.Surveys.SurveyID)
        <table style="width: 800px;">
        <tr>
        <th>Field</th>
        <th>Client Alias</th>
        <th>Default Client Value</th>
        <th>Use Mobile ?</th>
        <th>Mandatory</th>
        <th>Display Order</th>
        <th>Remove</th>
        </tr>
        @for (int i = 0; i < Model.ListExportMappings.Count(); i++)
        {
            <tr>
            <td>
            @if (Model.ListExportMappings[i].SurveyContactField != null)
            {
                <label>@(Model.ListExportMappings[i].SurveyContactField)</label>
            }
            else if (Model.ListExportMappings[i].SurveyMappingsID != null)
            {
                <label>@(Model.ListExportMappings[i].SurveyMapping.LeadStatQuestion.Question)</label>
            }
            else
            {
                <label>@(Model.ListExportMappings[i].ClientField)</label>
            }
            </td>
            <td>@Html.TextBoxFor(m => m.ListExportMappings[i].ClientFieldName, new { @class="largetextbox"})</td>
            <td>
            @Html.TextBoxFor(m => m.ListExportMappings[i].DefaultClientValue)
            </td>
            <td>
            @Html.EditorFor(m => m.ListExportMappings[i].CanUseMobile)
            </td>
            <td>
            @Html.EditorFor(m => m.ListExportMappings[i].Mandatory)
            </td>
            <td>
            @Html.TextBoxFor(m => m.ListExportMappings[i].ExportOrder)
            @Html.HiddenFor(m => m.ListExportMappings[i].ExportMappingsID)
            @Html.HiddenFor(m => m.ListExportMappings[i].SurveyID)
            @Html.HiddenFor(m => m.ListExportMappings[i].SurveyContactField)
            @Html.HiddenFor(m => m.ListExportMappings[i].SurveyMappingsID)
            @Html.HiddenFor(m => m.ListExportMappings[i].ClientField)
            </td>

            <td>
            <input type="checkbox" name="chkBoxRemove" value="@(Model.ListExportMappings[i].ExportMappingsID)" />
            </td>
            </tr>
        }        
        </table>

        <div class="spacer"></div>
        <table class="listtable contactstable" cellspacing="0" cellpadding="0" style="width: 600px;">
        <tr>
        <th class="tableheader">Tick To Add</th>
        <th class="tableheader">Contact Field</th>
        <th class="tableheader">Question</th>
        <th class="tableheader">Client Field</th>
        </tr>
        <tr>
        <td><input type="checkbox" id="chkAddThis" name="chkAddThis" value="true" /></td>
        <td>@Html.DropDownList("SurveyContactField", "Please select a Contact Field")</td>
        <td>@Html.DropDownList("SurveyMappingsID", "Please select a Survey Question")</td>
        <td><input type="text" name="ClientField" id="ClientField" value="" /> </td>
        </tr>
        </table>
        <div class="spacer"></div>
        <input type="submit" name="Save Changes" value="Update" class="bigsubmit" />
    </fieldset>
}
</div>

<script type="text/javascript">
    $(document).ready(function () {

    });
</script>
